<?php
require_once("../includes/Room_type.class.php");
require_once("../includes/Equipment_type.class.php");
?>

<form name="add_resource" action="add_resource_DB.php" method="post">
	<table>
	    <tr>
			<td> Resource type : </td>
			<td> <select name="resource_type" onchange="resource(this.options[this.selectedIndex].value)"> 
				    <option value=""> </option>
				    <option value="R"> Room </option>
				    <option value="E"> Equipment </option>
			    </select>
			</td>
			<td class="required last_check"></td>
		</tr>

		<tr class = "hiddenR">
            <td> Room type : </td>
            <td> <select name="room_type" >
                    <option value=""></option>
                    <?php
                     $Types = Room_type::find_all_ids();   
                     for ( $i = 0 ; $i < count($Types) ; $i++ )
                       {
                         echo "<option value =" . $Types[$i];
                         echo ">" . Room_type::find_type_name($Types[$i]) . "</option>";
                        }
                    ?>
                 </select>
            </td>
            <td class = "requiredR last_check"></td>
        </tr>

        <tr class = "hiddenE">
            <td> Equipment type : </td>
            <td> <select id = "equipment" name="equipment_type">
                    <option value=""></option>
                    <?php
                     $Types = Equipment_type::find_all_ids();   
                     for ( $i = 0 ; $i < count($Types) ; $i++ )
                       {
                         echo "<option value =" . $Types[$i];
                         echo ">" . Equipment_type::find_type_name($Types[$i]) . "</option>";
                        }
                    ?>
                 </select>
            </td>
            <td class = "requiredE last_check"></td>
        </tr>
        
        <tr>
     	    <td> name : </td>
     	    <td><input type="text" name="name" /></td>
     	    <td class="required last_check"></td>
        </tr>    
       
     <tr>
     	<td> Description : </td>
     	<td><input type="text" name="description" /></td>
     	<td class="required last_check"></td>
     </tr>
     
     <tr  class = "hiddenR">
     	<td> Capacity : </td>
     	<td><input type="text" name="capacity" /></td>
     	<td class="requiredR last_check"></td>
     </tr>
      
     <tr  class = "hiddenR">
     	<td> Position: </td>
     	<td><input type = "text" name = "position"/></td>
     	<td class="requiredR last_check"></td>
     </tr>
      
     <tr  class = "hiddenE">
     	<td> Date: </td>
     	<td><input type="date" name="date"></td>
     	<td class="requiredE last_check"></td>></td>
     </tr>
       
     <tr  class = "hiddenE">
     	<td> Model: </td>
     	<td> <input type="text" name="model" /> </td>
     	<td class="requiredE last_check" ></td>
     </tr>
     
     <tr  class = "hiddenE">
     	<td> State: </td>
     	<td> <input type="text" name="state" /></td>
     	<td class="requiredE last_check" ></td>
     </tr>

	 <tr>
        <td></td>
        <td></td>
        <td><input id="submit" type="button" value="Submit" onclick="validate_add_resource_form()"></td>
     </tr>	
</table>
</form>